package phoenics.manpads.stinger.model;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import org.springframework.beans.BeanUtils;
import phoenics.manpads.stinger.domain.enums.DatabaseType;
import phoenics.manpads.stinger.domain.po.Project;

import java.util.Date;

/**
 * @author Phoenics Chow
 * on 2019年01月20日
 */
public  class ProjectModel implements IModel{
    private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(ProjectModel.class);
    /**
     * id
     */
    private Long id;
    /**
     * 项目代码，英文名称
     */
    private  StringProperty projectName=new SimpleStringProperty();
    /**
     * 项目中文名称
     */
    private  StringProperty projectCnName=new SimpleStringProperty();
    /**
     * 数据库类型
     */
    private  ObjectProperty<DatabaseType> dbType=new SimpleObjectProperty<>();
    /**
     * 默认的包开头
     */
    private  StringProperty dfPackageHead=new SimpleStringProperty();
    /**
     * 模块名称
     */
    private  StringProperty modelName=new SimpleStringProperty();
    /**
     * 作者
     */
    private  StringProperty author=new SimpleStringProperty();
    /**
     * 作者邮箱
     */
    private  StringProperty email=new SimpleStringProperty();
    /**
     * 表前缀
     */
    private  StringProperty tablePrefix=new SimpleStringProperty();
    /**
     * 项目保存地址
     */
    private  StringProperty projectPath=new SimpleStringProperty();
    /**
     * 建立时间
     */
    private Date createTime;
    /**
     * 项目备注
     */
    private  StringProperty projectComment=new SimpleStringProperty();
    @Override
    public void clear() {
        projectNameProperty().set(null);
        projectCnNameProperty().set(null);
        dfPackageHeadProperty().set(null);
        modelNameProperty().set(null);
        authorProperty().set(null);
        emailProperty().set(null);
        tablePrefixProperty().set(null);
        projectPathProperty().set(null);
        projectCommentProperty().set(null);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProjectName() {
        return projectName.get();
    }

    public StringProperty projectNameProperty() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName.set(projectName);
    }

    public String getProjectCnName() {
        return projectCnName.get();
    }

    public StringProperty projectCnNameProperty() {
        return projectCnName;
    }

    public void setProjectCnName(String projectCnName) {
        this.projectCnName.set(projectCnName);
    }

    public DatabaseType getDbType() {
        return dbType.get();
    }

    public ObjectProperty<DatabaseType> dbTypeProperty() {
        return dbType;
    }

    public void setDbType(DatabaseType dbType) {
        this.dbType.set(dbType);
    }

    public String getDfPackageHead() {
        return dfPackageHead.get();
    }

    public StringProperty dfPackageHeadProperty() {
        return dfPackageHead;
    }

    public void setDfPackageHead(String dfPackageHead) {
        this.dfPackageHead.set(dfPackageHead);
    }

    public String getModelName() {
        return modelName.get();
    }

    public StringProperty modelNameProperty() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName.set(modelName);
    }

    public String getAuthor() {
        return author.get();
    }

    public StringProperty authorProperty() {
        return author;
    }

    public void setAuthor(String author) {
        this.author.set(author);
    }

    public String getEmail() {
        return email.get();
    }

    public StringProperty emailProperty() {
        return email;
    }

    public void setEmail(String email) {
        this.email.set(email);
    }

    public String getTablePrefix() {
        return tablePrefix.get();
    }

    public StringProperty tablePrefixProperty() {
        return tablePrefix;
    }

    public void setTablePrefix(String tablePrefix) {
        this.tablePrefix.set(tablePrefix);
    }

    public String getProjectPath() {
        return projectPath.get();
    }

    public StringProperty projectPathProperty() {
        return projectPath;
    }

    public void setProjectPath(String projectPath) {
        this.projectPath.set(projectPath);
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getProjectComment() {
        return projectComment.get();
    }

    public StringProperty projectCommentProperty() {
        return projectComment;
    }

    public void setProjectComment(String projectComment) {
        this.projectComment.set(projectComment);
    }

    @Override
    public String toString() {
        return this.getProjectCnName();
    }
}
